// var i;
// var AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
// var AL_GAME_HUA_Instance = require("./AL_GAME_HUA_Instance");
// var AL_GAME_HUA_Common = require("./AL_GAME_HUA_Common");
// var AL_GAME_HUA_PopupSelf = require("./AL_GAME_HUA_PopupSelf");
// var AL_GAME_HUA_AwardConfig = require("./AL_GAME_HUA_AwardConfig");
// var AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
// var AL_GAME_HUA_CurrencyData = require("./AL_GAME_HUA_CurrencyData");
// var AL_GAME_HUA_GameData = require("./AL_GAME_HUA_GameData");
// var AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
// var AL_GAME_HUA_PlatformManager = require("./AL_GAME_HUA_PlatformManager");
// var AL_GAME_HUA_EventConfig = require("./AL_GAME_HUA_EventConfig");
// var AL_GAME_HUA_MissionConfig = require("./AL_GAME_HUA_MissionConfig");
// var AL_GAME_HUA_PropConfig = require("./AL_GAME_HUA_PropConfig");
// var AL_GAME_HUA_WinBankNode = require("./AL_GAME_HUA_WinBankNode");
// var AL_GAME_HUA_GoodsConfig = require("./AL_GAME_HUA_GoodsConfig");
// var AL_GAME_HUA_ServerBackup = require("./AL_GAME_HUA_ServerBackup");
// var b = cc._decorator;
// var C = b.ccclass;
// var H = b.property;
// var I =
//     (b.menu,
//     (function (e) {
//         function t() {
//             var t = (null !== e && e.apply(this, arguments)) || this;
//             t.label_star = null;
//             t.label_progress = null;
//             t.bar = null;
//             t.label_recieve = null;
//             t.node_slide = null;
//             t.node_chou_jiang = null;
//             t.node_share_video = null;
//             t.node_video_button = null;
//             t.node_free_button = null;
//             t.label_free_button = null;
//             t.node_button_share = null;
//             t.label_share_coin = null;
//             t.com_bank_node = null;
//             t.multiple = 1;
//             t.is_slide = !0;
//             return t;
//         }
//         __extends(t, e);
//         t.prototype.onLoad = function () {
//             if (e.prototype.onLoad) {
//                 e.prototype.onLoad.call(this);
//             }
//             AL_GAME_HUA_Instance.Instance.xianshi_dingbu_tiao({
//                 target: this.node,
//                 showAll: !0
//             });
//         };
//         t.prototype.start = function () {
//             this.xianshi_jiage_huozhe_chaping();
//             this.node_free_button.active = !1;
//             this.node_video_button.active = !0;
//         };
//         t.prototype.chushihua_yinhang_jiedian = function () {
//             if (AL_GAME_HUA_GameConst.GameConst.getInstance().money_enabled) {
//                 this.com_bank_node.node.active = !0;
//             } else {
//                 {
//                     var e = AL_GAME_HUA_GameConst.GameConst.getInstance().pass_bank;
//                     this.com_bank_node.node.active = !1;
//                     AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
//                         type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
//                         num: e
//                     });
//                 }
//             }
//         };
//         t.prototype.xianshi_chaping = function () {
//             AL_GAME_HUA_Common.Common.xianshi_xiafang_guanggao();
//             AL_GAME_HUA_Common.Common.xianshiChapingGuanggaoWanchengshi(function () {
//                 var e = AL_GAME_HUA_GameConst.GameConst.getInstance().reward_coin;
//                 AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
//                     type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
//                     num: e
//                 });
//                 AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
//                     str: "获得x金币",
//                     params: [e.toString()]
//                 });
//             });
//         };
//         t.prototype.xianshi_jiage_huozhe_chaping = function () {
//             this.xianshi_chaping();
//         };
//         t.prototype.onDestroy = function () {
//             if (e.prototype.onDestroy) {
//                 e.prototype.onDestroy.call(this);
//             }
//             AL_APP_SDK_MANAGER.off(this);
//         };
//         t.prototype.chuli_fanhui_anniu_chumo_shijian = function () {};
//         t.prototype.zhixing_chushihua_chuli = function (e) {
//             this.options = e;
//             var t = this.options;
//             var n = t.star;
//             t.gold;
//             this.label_star.string = n.toString();
//             this.node_share_video.active = "tt" == ailin_sdk_manager.getSysPlatformName();
//             this.node_button_share.active = !1;
//             this.label_share_coin.string = AL_GAME_HUA_GameConst.GameConst.getInstance().share_reward.toString();
//             var o = AL_GAME_HUA_GameData.GameData.getInstance();
//             var i = AL_GAME_HUA_AwardConfig.AwardConfig.getInstance();
//             if (
//                 AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.NORMAL ||
//                 AL_GAME_HUA_Instance.Instance.LevelType == AL_GAME_HUA_Define.Define.LevelType.SPECIAL
//             ) {
//                 var r = o.huoqu_jiangli_shuliang();
//                 var a = i.genju_jishu_huoqu_jianli_xinxi(r).level;
//                 var s = o.huoqu_yijiesuo_guanqia() - 1 + o.huoqu_yijiesuo_teshu_guanqia() - 1;
//                 this.label_progress.string = s + "/" + a;
//                 this.bar.progress = s / a;
//             }
//             this.chushihua_yinhang_jiedian();
//             AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                 AL_GAME_HUA_MissionConfig.MissionType.LEVEL_DAILY
//             );
//             AL_GAME_HUA_MissionConfig.MissionConfig.getInstance().tianjia_renwu_shuliang_by_leixing(
//                 AL_GAME_HUA_MissionConfig.MissionType.LEVEL_TOTAL
//             );
//             this.yidong_slide();
//         };
//         t.prototype.chuli_xianshi_hou = function () {
//             if (this.com_bank_node.node.active) {
//                 this.com_bank_node.bofang_donghua();
//             }
//         };
//         t.prototype.recieve = function (e, t, n) {
//             var o = this;
//             this.node_chou_jiang.pauseAllActions();
//             AL_GAME_HUA_GameData.GameData.getInstance().tianjia_xingxing_shuliang(this.options.star * t);
//             AL_GAME_HUA_EventConfig.EventConfig.getInstance().assetsReportTransform({
//                 source: AL_GAME_HUA_EventConfig.AssetsSource.game,
//                 action:
//                     t > 1
//                         ? 2 == n
//                             ? AL_GAME_HUA_EventConfig.AssetsAction.video_get
//                             : AL_GAME_HUA_EventConfig.AssetsAction.share_get
//                         : AL_GAME_HUA_EventConfig.AssetsAction.get,
//                 goodsList: [
//                     {
//                         goods: AL_GAME_HUA_GoodsConfig.GoodsId.star,
//                         num: this.options.star * t
//                     }
//                 ]
//             });
//             this.baocun_paiming();
//             AL_GAME_HUA_AddPrefab.AddPrefab.zhixing_feixing_xingxing({
//                 count: 10,
//                 fromNode: e,
//                 onEnd: function () {
//                     o.qianwang_xiayige();
//                 }
//             });
//         };
//         t.prototype.baocun_paiming = function () {
//             if (cc.sys.isNative && cc.sys.os == cc.sys.OS_IOS) {
//                 ailin_sdk_manager.shezhiPaihangbangShuju("score", AL_GAME_HUA_GameData.GameData.getInstance().huoqu_xingxing_shuliang());
//             }
//             "tt" == ailin_sdk_manager.getSysPlatformName()
//                 ? AL_GAME_HUA_PlatformManager.PlatformManager.getInstance().tt.setImRankData({
//                       value: AL_GAME_HUA_GameData.GameData.getInstance().huoqu_xingxing_shuliang()
//                   })
//                 : "wx" == ailin_sdk_manager.getSysPlatformName() &&
//                   ailin_sdk_manager.tijiaoPaihangbangFenshu &&
//                   ailin_sdk_manager.tijiaoPaihangbangFenshu({
//                       data: {
//                           score: AL_GAME_HUA_GameData.GameData.getInstance().huoqu_xingxing_shuliang()
//                       }
//                   });
//         };
//         t.prototype.qianwang_xiayige = function () {
//             AL_GAME_HUA_ServerBackup.ServerBackup.zhixing_shifou_tijiao_cundang();
//             this.window.active = !1;
//             this.close();
//             AL_GAME_HUA_PropConfig.PropConfig.getInstance().huoqu_shuxing_jinru_xianshi()
//                 ? AL_GAME_HUA_AddPrefab.AddPrefab.create_prop_start({
//                       onClose: function () {
//                           AL_GAME_HUA_Instance.Instance.jinru_zhujiemian();
//                       }
//                   })
//                 : AL_GAME_HUA_Instance.Instance.jiancha_tili_shifou_zugou(
//                       function () {
//                           AL_GAME_HUA_Instance.Instance.qianwang_youxi();
//                       },
//                       function () {
//                           AL_GAME_HUA_Instance.Instance.jiancha_tili_shifou_zugou(function () {
//                               AL_GAME_HUA_Instance.Instance.qianwang_youxi();
//                           });
//                       },
//                       function () {
//                           AL_GAME_HUA_Instance.Instance.jinru_zhujiemian();
//                       }
//                   );
//         };
//         t.prototype.handle_button_callback = function (e, t) {
//             var n = this;
//             switch (t) {
//                 case "next":
//                     this.recieve(e.currentTarget, 1);
//                     this.xianshi_block_top();
//                     break;
//                 case "video":
//                     this.node_chou_jiang.pauseAllActions();
//                     this.xianshi_block_top();
//                     AL_GAME_HUA_Common.Common.showVideo({
//                         success: function (t) {
//                             n.recieve(e.currentTarget, n.multiple, t.type);
//                         },
//                         fail: function () {
//                             n.node_chou_jiang.resumeAllActions();
//                             n.yincang_block_top();
//                             AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
//                                 str: "暂无视频"
//                             });
//                         },
//                         completed: function () {}
//                     });
//                     break;
//                 case "free":
//                     this.node_chou_jiang.pauseAllActions();
//                     this.recieve(e.currentTarget, this.multiple);
//                     break;
//                 case "shareVideo":
//                     ailin_sdk_manager.xianshiFenxiangShipinDuihuakuang(function (t) {
//                         0 == t
//                             ? AL_APP_SDK_MANAGER.showToast("分享录屏失败")
//                             : 1 == t
//                             ? ((n.node_share_video.active = !1),
//                               AL_GAME_HUA_AddPrefab.AddPrefab.zhixing_feixing_jinbi({
//                                   count: 7,
//                                   fromNode: e.currentTarget,
//                                   onEnd: function () {
//                                       AL_GAME_HUA_GameData.GameData.getInstance();
//                                       AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
//                                           type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
//                                           num: AL_GAME_HUA_GameConst.GameConst.getInstance().share_video_coin
//                                       });
//                                   }
//                               }))
//                             : 2 == t && AL_APP_SDK_MANAGER.showToast("录屏时间太短了");
//                     });
//                     break;
//                 case "share":
//                     AL_GAME_HUA_Common.Common.share({
//                         location: AL_GAME_HUA_Define.Define.SHARE_LOCATION.RESULT,
//                         type: 3,
//                         success: function () {
//                             n.node_button_share.active = !1;
//                             AL_GAME_HUA_AddPrefab.AddPrefab.zhixing_feixing_jinbi({
//                                 count: 7,
//                                 fromNode: e.currentTarget,
//                                 onEnd: function () {
//                                     AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
//                                         type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
//                                         num: AL_GAME_HUA_GameConst.GameConst.getInstance().share_reward
//                                     });
//                                 }
//                             });
//                         },
//                         fail: function () {
//                             AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
//                                 str: "分享失败"
//                             });
//                         }
//                     });
//             }
//         };
//         t.prototype.yidong_slide = function () {
//             var e = this;
//             var t = this.node_slide.width;
//             var n = this.node_chou_jiang.x;
//             this.node_chou_jiang.progress = 0;
//             cc.tween(this.node_chou_jiang)
//                 .to(
//                     1,
//                     {
//                         progress: 1
//                     },
//                     {
//                         progress: function (o, i, r, a) {
//                             var s = o + (i - o) * a;
//                             e.node_chou_jiang.x = s * t + n;
//                             s >= 0 && s < 0.5
//                                 ? (e.multiple = 2)
//                                 : s >= 0.5 && s < 0.727
//                                 ? (e.multiple = 3)
//                                 : s >= 0.727 && s < 0.886
//                                 ? (e.multiple = 4)
//                                 : s >= 0.886 && s <= 1 && (e.multiple = 5);
//                             e.label_recieve.string = "x" + e.multiple;
//                             return s;
//                         }
//                     }
//                 )
//                 .to(
//                     1,
//                     {
//                         progress: 0
//                     },
//                     {
//                         progress: function (o, i, r, a) {
//                             var s = o + (i - o) * a;
//                             e.node_chou_jiang.x = s * t + n;
//                             s >= 0 && s < 0.5
//                                 ? (e.multiple = 2)
//                                 : s >= 0.5 && s < 0.727
//                                 ? (e.multiple = 3)
//                                 : s >= 0.727 && s < 0.886
//                                 ? (e.multiple = 4)
//                                 : s >= 0.886 && s <= 1 && (e.multiple = 5);
//                             e.label_recieve.string = "x" + e.multiple;
//                             return s;
//                         }
//                     }
//                 )
//                 .union()
//                 .repeatForever()
//                 .start();
//         };
//         __decorate([H(cc.Label)], t.prototype, "label_star", void 0);
//         __decorate([H(cc.Label)], t.prototype, "label_progress", void 0);
//         __decorate([H(cc.ProgressBar)], t.prototype, "bar", void 0);
//         __decorate([H(cc.Label)], t.prototype, "label_recieve", void 0);
//         __decorate([H(cc.Node)], t.prototype, "node_slide", void 0);
//         __decorate([H(cc.Node)], t.prototype, "node_chou_jiang", void 0);
//         __decorate([H(cc.Node)], t.prototype, "node_share_video", void 0);
//         __decorate([H(cc.Node)], t.prototype, "node_video_button", void 0);
//         __decorate([H(cc.Node)], t.prototype, "node_free_button", void 0);
//         __decorate([H(cc.Label)], t.prototype, "label_free_button", void 0);
//         __decorate([H(cc.Node)], t.prototype, "node_button_share", void 0);
//         __decorate([H(cc.Label)], t.prototype, "label_share_coin", void 0);
//         __decorate([H(AL_GAME_HUA_WinBankNode.default)], t.prototype, "com_bank_node", void 0);
//         return __decorate([C], t);
//     })(AL_GAME_HUA_PopupSelf.default));
// exports.default = I;


const AL_GAME_HUA_AddPrefab = require("./AL_GAME_HUA_AddPrefab");
const AL_GAME_HUA_Instance = require("./AL_GAME_HUA_Instance");
const AL_GAME_HUA_Common = require("./AL_GAME_HUA_Common");
const AL_GAME_HUA_PopupSelf = require("./AL_GAME_HUA_PopupSelf");
const AL_GAME_HUA_AwardConfig = require("./AL_GAME_HUA_AwardConfig");
const AL_GAME_HUA_GameConst = require("./AL_GAME_HUA_GameConst");
const AL_GAME_HUA_CurrencyData = require("./AL_GAME_HUA_CurrencyData");
const AL_GAME_HUA_GameData = require("./AL_GAME_HUA_GameData");
const AL_GAME_HUA_Define = require("./AL_GAME_HUA_Define");
const AL_GAME_HUA_PlatformManager = require("./AL_GAME_HUA_PlatformManager");
const AL_GAME_HUA_EventConfig = require("./AL_GAME_HUA_EventConfig");
const AL_GAME_HUA_MissionConfig = require("./AL_GAME_HUA_MissionConfig");
const AL_GAME_HUA_PropConfig = require("./AL_GAME_HUA_PropConfig");
const AL_GAME_HUA_WinBankNode = require("./AL_GAME_HUA_WinBankNode");
const AL_GAME_HUA_GoodsConfig = require("./AL_GAME_HUA_GoodsConfig");
const AL_GAME_HUA_ServerBackup = require("./AL_GAME_HUA_ServerBackup");
const { AL_SDK_Utils } = require("../../resources/scripts/AL_SDK_Utils");

const { ccclass, property } = cc._decorator;

@ccclass
class HPP_Popup extends AL_GAME_HUA_PopupSelf.default {
    @property(cc.Label)
    label_star = null;

    @property(cc.Label)
    label_progress = null;

    @property(cc.ProgressBar)
    bar = null;

    @property(cc.Label)
    label_recieve = null;

    @property(cc.Node)
    node_slide = null;

    @property(cc.Node)
    node_chou_jiang = null;

    @property(cc.Node)
    node_share_video = null;

    @property(cc.Node)
    node_video_button = null;

    @property(cc.Node)
    node_free_button = null;

    @property(cc.Label)
    label_free_button = null;

    @property(cc.Node)
    node_button_share = null;

    @property(cc.Label)
    label_share_coin = null;

    @property(AL_GAME_HUA_WinBankNode.default)
    com_bank_node = null;

    multiple = 1;
    is_slide = true;

    onLoad() {
        // 调用父类的 onLoad 方法
        super.onLoad && super.onLoad();
        
        // 显示顶部导航栏
        AL_GAME_HUA_Instance.Instance.xianshi_dingbu_tiao({
            target: this.node,
            showAll: true
        });
        AL_SDK_Utils.showInterAd();
    }

    start() {
        // 切换显示的奖品或者点
        this.xianshi_jiage_huozhe_chaping();
        
        // 设置按钮的初始激活状态
        this.node_free_button.active = false;
        this.node_video_button.active = true;
    }

    chushihua_yinhang_jiedian() {
        const isMoneyEnabled = AL_GAME_HUA_GameConst.GameConst.getInstance().money_enabled;
        
        if (isMoneyEnabled) {
            this.com_bank_node.node.active = true;
        } else {
            const passBankValue = AL_GAME_HUA_GameConst.GameConst.getInstance().pass_bank;
            this.com_bank_node.node.active = false;
            
            // 添加货币
            AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
                type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
                num: passBankValue
            });
        }
    }

    xianshi_chaping() {
        // 显示底部内容
        AL_GAME_HUA_Common.Common.xianshi_xiafang_guanggao();
        
        // 依据完成状态显示标志
        AL_GAME_HUA_Common.Common.xianshiChapingGuanggaoWanchengshi(() => {
            const rewardCoin = AL_GAME_HUA_GameConst.GameConst.getInstance().reward_coin;
            
            // 添加金币
            AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
                type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
                num: rewardCoin
            });
            
            // 创建提示节点
            AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
                str: "获得x金币",
                params: [rewardCoin.toString()]
            });
        });
    }

    xianshi_jiage_huozhe_chaping() {
        this.xianshi_chaping();
    }

    onDestroy() {
        super.onDestroy && super.onDestroy();
        AL_APP_SDK_MANAGER.off(this);
    }

    chuli_fanhui_anniu_chumo_shijian() {}

    zhixing_chushihua_chuli(options) {
        this.options = options;
        const star = this.options.star;
        this.label_star.string = star.toString();
        
        this.node_share_video.active = ailin_sdk_manager.getSysPlatformName() === "tt";
        this.node_button_share.active = false;
        
        const shareReward = AL_GAME_HUA_GameConst.GameConst.getInstance().share_reward;
        this.label_share_coin.string = shareReward.toString();
        
        const gameData = AL_GAME_HUA_GameData.GameData.getInstance();
        const awardConfig = AL_GAME_HUA_AwardConfig.AwardConfig.getInstance();
        
        const { NORMAL, SPECIAL } = AL_GAME_HUA_Define.Define.LevelType;
        const levelType = AL_GAME_HUA_Instance.Instance.LevelType;
        
        if (levelType === NORMAL || levelType === SPECIAL) {
            const awardNum = gameData.huoqu_jiangli_shuliang();
            const level = awardConfig.genju_jishu_huoqu_jianli_xinxi(awardNum).level;
            const unlockLevels = gameData.huoqu_yijiesuo_guanqia() - 1 + gameData.huoqu_yijiesuo_teshu_guanqia() - 1;
            
            this.label_progress.string = `${unlockLevels}/${level}`;
            this.bar.progress = unlockLevels / level;
        }
        
        this.chushihua_yinhang_jiedian();
        
        const missionConfig = AL_GAME_HUA_MissionConfig.MissionConfig.getInstance();
        
        missionConfig.tianjia_renwu_shuliang_by_leixing(AL_GAME_HUA_MissionConfig.MissionType.LEVEL_DAILY);
        missionConfig.tianjia_renwu_shuliang_by_leixing(AL_GAME_HUA_MissionConfig.MissionType.LEVEL_TOTAL);
        
        this.yidong_slide();
    }

    chuli_xianshi_hou() {
        if (this.com_bank_node.node.active) {
            this.com_bank_node.bofang_donghua();
        }
    }

    recieve(target, multiplier, type) {
        this.node_chou_jiang.pauseAllActions();
        
        const gameDataInstance = AL_GAME_HUA_GameData.GameData.getInstance();
        gameDataInstance.tianjia_xingxing_shuliang(this.options.star * multiplier);
        
        const { EventConfig, AssetsSource, AssetsAction } = AL_GAME_HUA_EventConfig;
        
        EventConfig.getInstance().assetsReportTransform({
            source: AssetsSource.game,
            action: multiplier > 1 ? (type === 2 ? AssetsAction.video_get : AssetsAction.share_get) : AssetsAction.get,
            goodsList: [{
                goods: AL_GAME_HUA_GoodsConfig.GoodsId.star,
                num: this.options.star * multiplier
            }]
        });
        
        this.baocun_paiming();
        
        AL_GAME_HUA_AddPrefab.AddPrefab.zhixing_feixing_xingxing({
            count: 10,
            fromNode: target,
            onEnd: () => {
                this.qianwang_xiayige();
            }
        });
    }

    baocun_paiming() {
        const gameDataInstance = AL_GAME_HUA_GameData.GameData.getInstance();
        const starNum = gameDataInstance.huoqu_xingxing_shuliang();
        
        if (cc.sys.isNative && cc.sys.os === cc.sys.OS_IOS) {
            ailin_sdk_manager.shezhiPaihangbangShuju("score", starNum);
        }
        
        const currentPlatform = ailin_sdk_manager.getSysPlatformName();
        
        if (currentPlatform === "tt") {
            const platformManager = AL_GAME_HUA_PlatformManager.PlatformManager.getInstance().tt;
            platformManager.setImRankData({ value: starNum });
        } else if (currentPlatform === "wx" && ailin_sdk_manager.tijiaoPaihangbangFenshu) {
            ailin_sdk_manager.tijiaoPaihangbangFenshu({ data: { score: starNum } });
        }
    }

    qianwang_xiayige() {
        const instance = AL_GAME_HUA_Instance.Instance;
        
        AL_GAME_HUA_ServerBackup.ServerBackup.zhixing_shifou_tijiao_cundang();
        this.window.active = false;
        this.close();
        
        if (AL_GAME_HUA_PropConfig.PropConfig.getInstance().huoqu_shuxing_jinru_xianshi()) {
            AL_GAME_HUA_AddPrefab.AddPrefab.create_prop_start({
                onClose: () => instance.jinru_zhujiemian()
            });
        } else {
            instance.jiancha_tili_shifou_zugou(
                () => instance.qianwang_youxi(),
                () => instance.jiancha_tili_shifou_zugou(() => instance.qianwang_youxi()),
                () => instance.jinru_zhujiemian()
            );
        }
    }

    handle_button_callback(event, action) {
        const target = event.currentTarget;
        
        switch (action) {
            case "next":
                this.recieve(target, 1);
                this.xianshi_block_top();
                break;
            case "video":
                this.node_chou_jiang.pauseAllActions();
                this.xianshi_block_top();
                
                AL_GAME_HUA_Common.Common.showVideo({
                    success: ({ type }) => this.recieve(target, this.multiple, type),
                    fail: () => {
                        this.node_chou_jiang.resumeAllActions();
                        this.yincang_block_top();
                        
                        AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
                            str: "暂无视频"
                        });
                    }
                });
                break;
            case "free":
                this.node_chou_jiang.pauseAllActions();
                this.recieve(target, this.multiple);
                break;
            case "shareVideo":
                ailin_sdk_manager.xianshiFenxiangShipinDuihuakuang((result) => {
                    if (result === 0) {
                        AL_APP_SDK_MANAGER.showToast("分享录屏失败");
                    } else if (result === 1) {
                        this.node_share_video.active = false;
                        
                        AL_GAME_HUA_AddPrefab.AddPrefab.zhixing_feixing_jinbi({
                            count: 7,
                            fromNode: target,
                            onEnd: () => {
                                AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
                                    type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
                                    num: AL_GAME_HUA_GameConst.GameConst.getInstance().share_video_coin
                                });
                            }
                        });
                    } else if (result === 2) {
                        AL_APP_SDK_MANAGER.showToast("录屏时间太短了");
                    }
                });
                break;
            case "share":
                AL_GAME_HUA_Common.Common.share({
                    location: AL_GAME_HUA_Define.Define.SHARE_LOCATION.RESULT,
                    type: 3,
                    success: () => {
                        this.node_button_share.active = false;
                        
                        AL_GAME_HUA_AddPrefab.AddPrefab.zhixing_feixing_jinbi({
                            count: 7,
                            fromNode: target,
                            onEnd: () => {
                                AL_GAME_HUA_CurrencyData.CurrencyData.getInstance().tianjia_huobi({
                                    type: AL_GAME_HUA_CurrencyData.CurrencyType.COIN,
                                    num: AL_GAME_HUA_GameConst.GameConst.getInstance().share_reward
                                });
                            }
                        });
                    },
                    fail: () => {
                        AL_GAME_HUA_AddPrefab.AddPrefab.chuangjian_tishi_jiedian_mianban({
                            str: "分享失败"
                        });
                    }
                });
                break;
        }
    }

    yidong_slide() {
        const self = this;
        const initWith = this.node_slide.width;
        const choujiangX = this.node_chou_jiang.x;
        this.node_chou_jiang.progress = 0;
        cc.tween(this.node_chou_jiang)
            .to(
                1,
                {
                    progress: 1
                },
                {
                    progress: function (o, i, r, a) {
                        let s = o + (i - o) * a;
                        self.node_chou_jiang.x = s * initWith + choujiangX;
                        s >= 0 && s < 0.5
                            ? (self.multiple = 2)
                            : s >= 0.5 && s < 0.727
                                ? (self.multiple = 3)
                                : s >= 0.727 && s < 0.886
                                    ? (self.multiple = 4)
                                    : s >= 0.886 && s <= 1 && (self.multiple = 5);
                        self.label_recieve.string = "x" + self.multiple;
                        return s;
                    }
                }
            )
            .to(
                1,
                {
                    progress: 0
                },
                {
                    progress: function (o, i, r, a) {
                        let s = o + (i - o) * a;
                        self.node_chou_jiang.x = s * initWith + choujiangX;
                        s >= 0 && s < 0.5
                            ? (self.multiple = 2)
                            : s >= 0.5 && s < 0.727
                                ? (self.multiple = 3)
                                : s >= 0.727 && s < 0.886
                                    ? (self.multiple = 4)
                                    : s >= 0.886 && s <= 1 && (self.multiple = 5);
                        self.label_recieve.string = "x" + self.multiple;
                        return s;
                    }
                }
            )
            .union()
            .repeatForever()
            .start();
    }
}

exports.default = HPP_Popup;